<?php
	include("config.php");
	include("cookie.php");
	$username = substr($user, 0, strrpos($user,"|"));
?>
<?php
$sName		= $_REQUEST['name'];
$sTelphone	= $_REQUEST['phone'];
$sIcq		= $_REQUEST['icq'];
$sAddress 	= $_REQUEST['address'];
if (!$sName || !$sTelphone || !$sIcq || !$sAddress) die("请输入数据");
$dbLink	= mysql_connect ($sServer, $sUserName, $sPassword) or die("数据库Connect错误");
mysql_select_db ($sDBname, $dbLink) or die("数据库Select错误");
$sSQL = "insert into friends (name, telephone, icq, address,username) values('{$sName}','{$sTelphone}','{$sIcq}','{$sAddress}','{$username}')";
$bRes = mysql_query ($sSQL, $dbLink);
if ($bRes == TURE)
{
	header("Location:list.php");
}
else
{
	echo "输入数据失败<br>";
}
mysql_close ($dbLink);
?>
